package com.jing.countmvvmdemo;

import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import androidx.lifecycle.ViewModelProvider;

import com.jing.countmvvmdemo.viewModel.CountViewModel;
import com.jing.countmvvmdemo.databinding.ActivityMainBinding;
import com.jing.countmvvmdemo.viewModel.factory.CounterViewModelFactory;

public class MainActivity extends AppCompatActivity {

    CountViewModel countViewModel;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        ActivityMainBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_main);
//        CounterViewModelFactory factory = new CounterViewModelFactory(10);
        countViewModel = new CountViewModel(); //new ViewModelProvider(this, factory).get(CountViewModel.class);
        binding.setCountViewModel(countViewModel);
        binding.setLifecycleOwner(this);
    }
}